# -*- coding: utf-8 -*-

import py_global
import logging

from redis import Redis
from redis.cluster import RedisCluster, ClusterNode

logger = logging.getLogger(__name__)

if __name__ == '__main__':
    password = ''
    host_port = 'host1:26379,host2:26379,host3:26379'

    nodes = list()
    for node in host_port.split(','):
        for host, port in node:
            node = ClusterNode(host=host, port=int(port))
            nodes.append(node)

    redis_cluster = RedisCluster(startup_nodes=nodes)

    redis_cluster.set('key', 'value')
